import { ApolloQueryResult, FetchResult, FetchPolicy } from '@apollo/client/core';
import { Observable } from 'rxjs';
/**************************************************************************************
 * 管理员管理
 */
/*************************************************************************************
 * 服务接口定义
 */
export interface AdministratorServiceApi {
  list(variables: AdministratorService_listVariables, options:AdministratorServiceQueryOptions): Observable<ApolloQueryResult<AdministratorService_listResult>>; // 分页查询
  totalCount(): Observable<ApolloQueryResult<AdministratorService_totalCountResult>>; // 统计库中所有对象的数据量
  search(variables: AdministratorService_searchVariables, options:AdministratorServiceQueryOptions): Observable<ApolloQueryResult<AdministratorService_searchResult>>; // 游标查询
  loadAll(): Observable<ApolloQueryResult<AdministratorService_loadAllResult>>; // 获取库中所有数据，数据量大时请谨慎使用
  getById(variables: AdministratorService_getByIdVariables, options:AdministratorServiceQueryOptions): Observable<ApolloQueryResult<AdministratorService_getByIdResult>>; // 获取一个对象
  createAdmin(variables: AdministratorService_createAdminVariables): Observable<FetchResult<AdministratorService_createAdminResult>>; // 创建管理员
  save(variables: AdministratorService_saveVariables): Observable<FetchResult<AdministratorService_saveResult>>; // 保存对象
  removeById(variables: AdministratorService_removeByIdVariables): Observable<FetchResult<AdministratorService_removeByIdResult>>; // 删除一个对象
  removeByIdList(variables: AdministratorService_removeByIdListVariables): Observable<FetchResult<AdministratorService_removeByIdListResult>>; // 删除一批对象
}
export interface AdministratorServiceQueryOptions{
  cachePolicy:FetchPolicy;
  more:boolean;
}

/**
 * 分页查询
 */
export interface AdministratorService_listResult{
    administratorService_list: AdministratorConnection;
}
export interface AdministratorService_listVariables{
      filter: AdministratorFilter; // 过滤条件
      orderBy?: AdministratorOrderBy; // 排序方式
}

/**
 * 统计库中所有对象的数据量
 */
export interface AdministratorService_totalCountResult{
    administratorService_totalCount: number;
}

/**
 * 游标查询
 */
export interface AdministratorService_searchResult{
    administratorService_search: AdministratorConnection;
}
export interface AdministratorService_searchVariables{
      first: number; // 获取数据量
      offset: number; // 获取数据起始位置
      filter: AdministratorFilter; // 过滤条件
      orderBy?: AdministratorOrderBy; // 排序方式
}

/**
 * 获取库中所有数据，数据量大时请谨慎使用
 */
export interface AdministratorService_loadAllResult{
    administratorService_loadAll: AdministratorConnection;
}

/**
 * 获取一个对象
 */
export interface AdministratorService_getByIdResult{
    administratorService_getById: AdministratorPackage;
}
export interface AdministratorService_getByIdVariables{
      id: string; // 对象的ID值
}


export interface AdministratorService_createAdminResult{
  administratorService_createAdmin: AdministratorMutationInfo;
}

/**
 * 创建管理员
 */
export interface AdministratorService_createAdminVariables{
    administrator: AdministratorInput; // 管理员
    password: string; // 密码
}

export interface AdministratorService_saveResult{
  administratorService_save: AdministratorMutationInfo;
}

/**
 * 保存对象
 */
export interface AdministratorService_saveVariables{
    entity: AdministratorInput; // 保存对象，无id值新增，有id值修改，如果修改未找到对象则抛出异常修改失败
}

export interface AdministratorService_removeByIdResult{
  administratorService_removeById: AdministratorMutationInfo;
}

/**
 * 删除一个对象
 */
export interface AdministratorService_removeByIdVariables{
    id: string; // 对象ID值
}

export interface AdministratorService_removeByIdListResult{
  administratorService_removeByIdList: AdministratorMutationInfo;
}

/**
 * 删除一批对象
 */
export interface AdministratorService_removeByIdListVariables{
    ids: string[]; // 对象ID值列表
}
/**
 * 错误信息
 */
export interface AdministratorErrorBody {
  message: string;
  stackTrace: string;
}

/**
 * 查询结果信息
 */
export interface AdministratorResultInfo {
  totalCount: number;
  queryTime: number;
  sign: string;
  message: string;
}

/**
 * 分页信息
 */
export interface AdministratorPageInfo{
  page: number;
  size: number;
  offset: number;
  endCursor: string;
  hasNextPage: boolean;
}

/**
 * 查询集合返回对象
 */
export interface  AdministratorConnection{
  resultInfo: AdministratorResultInfo;
  edges: AdministratorViewEdge[];
  pageInfo: AdministratorPageInfo;
  uuid: string;
}
export interface AdministratorViewEdge{
  node:AdministratorView;
}
/**
 * 查询单个对象返回结果
 */
export interface AdministratorPackage{
  resultInfo: AdministratorResultInfo;
  entity: AdministratorView;
  uuid: string;
}

/**
 * 排序类型
 */
export interface AdministratorOrderBy {
  field: string;
  type: 'ASC' | 'DESC';
}

/**
 * 更新返回结果信息
 */
export interface AdministratorMutationInfo {
  status: boolean;
  rows: number;
  messages: string;
  uuid: string;
  sign: string;
  executeTime: number;
  result: AdministratorView;
}

/**
 * 字符串筛选接口
 */
export interface AdministratorStringFilter {
  eq?: string;
  neq?: string;
  like?: string;
  in?: string[];
  nin?: string[];
  gt?: string;
  lt?: string;
  gte?: string;
  lte?: string;
}

/**
 * 数字过滤条件接口
 */
export interface AdministratorNumberFilter {
  eq?: number;
  neq?: number;
  in?: number[];
  nin?: number[];
  gt?: number;
  lt?: number;
  gte?: number;
  lte?: number;
}

/**
 * 布尔类型删选接口
 */
export interface AdministratorBooleanFilter {
  eq?: boolean;
  neq?: boolean;
}




/*****************************************************************************************
 * 查询接口
 */
export const administratorServiceQuery = {
   // 分页查询
  administratorService_list: `administratorService_list(filter:$filter,orderBy:$orderBy){
    resultInfo{
      totalCount
      queryTime
      sign
      message
    }
    edges{
      node{
      code
      name
      permissions
      id
        }
    }
    pageInfo{
      page
      size
      offset
      hasNextPage
      endCursor
    }
    uuid
  }`
, // 统计库中所有对象的数据量
  administratorService_totalCount: `administratorService_totalCount`
, // 游标查询
  administratorService_search: `administratorService_search(first:$first,offset:$offset,filter:$filter,orderBy:$orderBy){
    resultInfo{
      totalCount
      queryTime
      sign
      message
    }
    edges{
      node{
      code
      name
      permissions
      id
        }
    }
    pageInfo{
      page
      size
      offset
      hasNextPage
      endCursor
    }
    uuid
  }`
, // 获取库中所有数据，数据量大时请谨慎使用
  administratorService_loadAll: `administratorService_loadAll{
    resultInfo{
      totalCount
      queryTime
      sign
      message
    }
    edges{
      node{
      code
      name
      permissions
      id
        }
    }
    pageInfo{
      page
      size
      offset
      hasNextPage
      endCursor
    }
    uuid
  }`
, // 获取一个对象
  administratorService_getById: `administratorService_getById(id:$id){
    resultInfo{
      totalCount
      queryTime
      sign
      message
    }
    entity{
      code
      name
      permissions
      id
    }
    uuid
  }`
};

/*********************************************************************
 * 更新接口信息
 */
export const administratorServiceMutation = {
   // 创建管理员
  administratorService_createAdmin: `administratorService_createAdmin(administrator:$administrator,password:$password){
    status
    rows
    messages
    uuid
    sign
    executeTime
    result{
      code
      name
      permissions
      id
    }
    errorBody{
      message
      stackTrace
    }
  }`
, // 保存对象
  administratorService_save: `administratorService_save(entity:$entity){
    status
    rows
    messages
    uuid
    sign
    executeTime
    result{
      code
      name
      permissions
      id
    }
    errorBody{
      message
      stackTrace
    }
  }`
, // 删除一个对象
  administratorService_removeById: `administratorService_removeById(id:$id){
    status
    rows
    messages
    uuid
    sign
    executeTime

    errorBody{
      message
      stackTrace
    }
  }`
, // 删除一批对象
  administratorService_removeByIdList: `administratorService_removeByIdList(ids:$ids){
    status
    rows
    messages
    uuid
    sign
    executeTime

    errorBody{
      message
      stackTrace
    }
  }`
};

/************************************************************************
 * 类型信息
 */
/**
 * 运营商管理账户
 */
export interface AdministratorStore {
  code?: string; // 账户编号
  name?: string; // 账户名称
  permissions?: number; // 账号权限
  id?: number; // 未说明
  [props: string]: any;
}
/**
 * 运营商管理账户
 */
export interface AdministratorView {
  code?: string; // 账户编号
  name?: string; // 账户名称
  permissions?: number; // 账号权限
  id?: number; // 未说明
  [props: string]: any;
}
/**
 * 运营商管理账户
 */
export interface AdministratorInput {
  code?: string; // 账户编号
  name?: string; // 账户名称
  permissions?: number; // 账号权限
  id?: number; // 未说明
  [props: string]: any;
}
/**
 * 运营商管理账户
 */
export interface AdministratorFilter {
  code?: AdministratorStringFilter; // 账户编号
  name?: AdministratorStringFilter; // 账户名称
  permissions?: AdministratorNumberFilter; // 账号权限
  id?: AdministratorNumberFilter; // 未说明
  [props: string]: any;
}
